package com.ruoyi.newSystem.bean.input;

import cn.hutool.core.util.StrUtil;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.AssertTrue;

/**
 * The type Auth login req vo.
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AuthLoginReqVO {


    private String username;


    private String password;

    @NotBlank(message = "钉钉授权码不能为空")
    private String authCode;

    // ========== 图片验证码相关 ==========

    private Integer socialType;

    private String socialCode;

    private String socialState;

    /**
     * 开启验证码的 Group
     */
    public interface CodeEnableGroup {}

    /**
     * Is social code valid boolean.
     *
     * @return the boolean
     */
    @AssertTrue(message = "授权码不能为空")
    public boolean isSocialCodeValid() {
        return socialType == null || StrUtil.isNotEmpty(socialCode);
    }

    /**
     * Is social state boolean.
     *
     * @return the boolean
     */
    @AssertTrue(message = "授权 state 不能为空")
    public boolean isSocialState() {
        return socialType == null || StrUtil.isNotEmpty(socialState);
    }

}
